@file:JvmName("Job")

package hos.thread

import hos.thread.hander.MH
import hos.thread.hander.MainHandler

/**
 * <p>Title: Job </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @date : 2023/8/5 12:28
 * @version : 1.0
 */


@JvmOverloads
inline fun runUI(
    handle: ThreadOption.UI = ThreadOption.UI.ON,
    time: Long = 300,
    crossinline block: MainHandler.() -> Unit,
) = MH.run(handle, time, block)

@JvmOverloads
inline fun <T> runJob(
    job: ThreadOption.Job = ThreadOption.Job.ON,
    crossinline block: (RunnableJob<T>.() -> T),
) = RunnableJob.run<T>(job) {
    block(this)
}

inline fun <T> getJob(
    crossinline block: (RunnableJob<T>.() -> T),
) = RunnableJob.get<T>() {
    block(this)
}
